package org.jeecg.modules.yks.srv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.yks.dev.entity.DevEquipmentConfigProduct;
import org.jeecg.modules.yks.dev.entity.YksEquipmentConfigurationPart;
import org.jeecg.modules.yks.dev.mapper.DevEquipmentConfigProductMapper;
import org.jeecg.modules.yks.dev.mapper.YksEquipmentConfigurationPartMapper;
import org.jeecg.modules.yks.srv.entity.YksEquipmentDevopsMaterialDetail;
import org.jeecg.modules.yks.srv.mapper.YksEquipmentDevopsMaterialDetailMapper;
import org.jeecg.modules.yks.srv.service.IYksEquipmentDevopsMaterialDetailService;
import org.jeecg.modules.yks.srv.service.IYksEquipmentDevopsServiceService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 运维材料表
 * @Author: jeecg-boot
 * @Date:   2024-01-16
 * @Version: V1.0
 */
@Service
public class YksEquipmentDevopsMaterialDetailServiceImpl extends ServiceImpl<YksEquipmentDevopsMaterialDetailMapper, YksEquipmentDevopsMaterialDetail> implements IYksEquipmentDevopsMaterialDetailService {

	@Autowired
	private YksEquipmentConfigurationPartMapper yksEquipmentConfigurationPartMapper;

	@Autowired
	private YksEquipmentDevopsMaterialDetailMapper yksEquipmentDevopsMaterialDetailMapper;
	
	@Override
	public List<YksEquipmentDevopsMaterialDetail> selectByMainId(String mainId) {
		List<YksEquipmentDevopsMaterialDetail> list = yksEquipmentDevopsMaterialDetailMapper.selectByMainId(mainId);
		for (YksEquipmentDevopsMaterialDetail item: list
			 ) {
			YksEquipmentConfigurationPart cfg = yksEquipmentConfigurationPartMapper.selectById(item.getPartConfigId());
			if (cfg !=null) {
				item.setCheckGap(cfg.getCheckGap());
				item.setCheckDate(cfg.getCheckDate());
				item.setMaintenanceGap(cfg.getMaintenanceGap());
				item.setMaintenanceDate(cfg.getMaintenanceDate());
				item.setChangeGap(cfg.getChangeGap());
				item.setChangeDate(cfg.getChangeDate());
				item.setLocationNumber(cfg.getLocationNumber());
			}
		}
		return list;
	}
}
